Skip to content

[Tracking] Simulation Interface #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 135 commits into from
Aug 2, 2024

Conversation

benflexcompute
Copy link
Collaborator

No description provided.

maciej-flexcompute and others added 2 commits May 1, 2024 14:58
* added strucuture and interface for Simulation object

update design with some grouping and renaming, added user_stories to fill in

Added example

FORMAT

Added the diagram

Added stripped Flow360BaseModel

Removed allow_but_remove

WIP on updating the BaseModel to pydantic V2

WIP

Add more docstring for details

* Updated the base model to V2 in simulation

* Fix unit test

* Lint

* fresh install

* Add CI to UnderConstruction/SimulationInterface

* Try again

* Try again

* Try again

---------

Co-authored-by: benflexcompute <ben@flexcompute.com>
@benflexcompute benflexcompute changed the title Simulation Interface [Tracking] Simulation Interface May 9, 2024
feilin-flexcompute and others added 8 commits May 14, 2024 11:57
* added geometry api

* address comments
* Added meshing Param

* remove temp file

* Finished field population, will refine tomorrow

* Added more examples

* Changed models according to discussion. Will change examples now

* Applied the suggestions to examples too

* More example fixes

* Fix more examples

* Removed Simulation class
comments addressed

lint

print version of isort
benflexcompute and others added 16 commits May 21, 2024 18:28
* Entities implementation completed. The rest of relevant work is how and when _expand_entities function is called

Created folder for new tests

Removed ambiguity in implementation

Fix format

Applied Maciej's suggestion, trying to abstract it now

Added EntityList

Added default expansion to all entities

Added input validation and more unit tests

None input validation

* Removed the use of global registry

* Raise error when valid_types is None

* Removed comments and unnecessary comment

* comments addressed

* Address final decorator comment

* Fix unit test
* [ModelRef] Added Field Definitions for **UserDefinedDynamics**

format

* Update
…fault for it when EntityList is not required (#277)
* [ModelRef] Added Field Definitions for Outputs

Removed test artifacts

Fix format

* Added Entity Implementation

* Comments addressed

* Fix unit test

* Addressed comments

* Fix unit test?
* basic support for pydantic v2 supported in unit system

* implemented pydantic v2 support for unit system constrained types

* attempt to use json encoders for unyt quantities

* WIP - Splitting unit system implementations, supporting unit system in pydantic 2

* WIP - Fix runtime errors after pydantic v2 migration, fix tests

* Fixed serialization issues

* Fix schema issues and tests

* Test fixes

* Style fixes

* Migrate Axis and Vector types to support pydantic v2, remove pd1-specific types from type definitions

* Remove print statements and leftover code from legacy unit system class

* Fix temperature type validator in pydantic v2 version

---------

Co-authored-by: Andrzej Krupka <andrzej@flexcompute.com>
* [ModelRef] Added Field Definitions for **TimeStepping**

Comments addressed

* Comments addressed

* Update default
* [ModelRef] Added Field Definitions for **ReferenceGeometry**

* added some thoughts in docstring

* Fix unit test
* create surface mesh from geometry id

* remove _0 in the naming

* rename an example file

* address comments

* address comments

* fix key in Cylinder class

* fix path of resources in examples

* remove dev env settting; keep geometry file name in remote

* added preprod env handling (#282)

Co-authored-by: Feilin <52168719+feilin-flexcompute@users.noreply.github.com>

* use dev in geometry example

* address comments

* fix surface mesh cylinder from 3rd party

* remove iges support

---------

Co-authored-by: Maciej Skarysz <83596707+maciej-flexcompute@users.noreply.github.com>
feilin-flexcompute and others added 11 commits July 23, 2024 20:39
* fix surface_mesh and upload examples for surface meshing

* lint
* Symmetry Plane

* Added XV15HoverMRF + fixed C_D and C_DES for kOmegaSST

* Added NestedCylindersSRF

* Fixed unit test

* Added heatFluxCylinder

* Added plateASI
* Add discriminator for some single attribute models

* Fix unit tests
* Rename Probe to ProbeGroup to avoid confusion

* Corrected alias
* Fix missing value error in __init__ signature

* Removed debug code
* The surface mesh generation works. Now we try to generailize it

* Revert flow360/ changes

* Self review now

* Fix lint

* Add log

* Chenage warning

* Fix lint

* Move old requests to requests_v1

* Put the reqeust_v2 as request

* MV geometry to geometry_V1

* Moved v2 geometry to geometry

* interface --> interface_v1

* geometry_v2 --> geometry

* Renamed resource_base to resource_base_v1

* resource base v2 --> resource_base

* change import

* Add path API for future use

* self review

* MERGE flow360/cloud/requests_v1.py and flow360/cloud/requests.py

* Corrected imports from interfaces_v1

* MERGE resource_base_v1 and resource_base

* Removed deferred_400_error_handling

* List options for valid meshing units

* Address comments

* Added test

* moved solver version into the constructor of draft

* Format

* fix pytest

* Comment addressed

* Added cloud module

* Fix UUID validation check

* Address comments
@benflexcompute benflexcompute marked this pull request as ready for review August 1, 2024 15:50
Comment on lines +154 to +156
def get_base_angle():
# pylint: disable=no-member
return 1 * u.rad
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think base values are unitless. I think this will break. Do we have any usage or test for converting angles?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we used to have any angle type in Flow360Params

@@ -18,6 +18,7 @@ def _no_update(params_as_dict):
("23.3.0", "23.3.*", _no_update),
("23.3.*", "24.2.*", _no_update),
("24.2.*", "24.2.*", _no_update),
("24.2.*", "24.3.*", _no_update), # we should not allow to submit Flow360Params to version 24.3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have release 24.3 ? I don't think so. I think this should be update from 24.2 to 24.7. But the problem we might get is with all the JSONs generated in the past months, they might have version 24.3.0 inside

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Let's keep this as it for now. If 24.7 cannot wait for the simulation then we also add it here then.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to keep this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not used anywhere except examples. Let's remove this.

Comment on lines +112 to +114
def run_case(source_asset: AssetBase, params: SimulationParams, async_mode: bool = True):
"""run case from the geometry"""
return _run(source_asset, params, Case, async_mode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since
geometry -> case, or
volume_mesh -> case
will be the most often used options, can we alias this to "run"?

Suggested change
def run_case(source_asset: AssetBase, params: SimulationParams, async_mode: bool = True):
"""run case from the geometry"""
return _run(source_asset, params, Case, async_mode)
def run(source_asset: AssetBase, params: SimulationParams, async_mode: bool = True):
"""run case from the geometry"""
return _run(source_asset, params, Case, async_mode)

also, how user will provide name for new case?

Copy link
Collaborator Author

@benflexcompute benflexcompute Aug 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think run_case is fine. It is not a very long name. run makes it seems like there should be an argument to specify the destination.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the case name appears to be Case_${draft name}. We need back end change for a complete support for user specified case name.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to delete entire user_story_examples

Comment on lines 84 to 102
# Standard atmosphere constants
t0 = 288.15 * u.K # Sea level standard temperature
p0 = 101325 * u.Pa # Sea level standard pressure
lapse_rate = 0.0065 * u.K / u.m # Temperature lapse rate
r = Air().gas_constant # Specific gas constant for dry air
g0 = 9.80665 * u.m / u.s**2 # Standard gravity

# Calculate temperature at the given altitude
temperature = t0 - lapse_rate * altitude
temperature += temperature_offset

# Calculate pressure at the given altitude
pressure = p0 * (1 - (lapse_rate * altitude / t0)) ** (g0 / (r * lapse_rate))

# Calculate density at the given altitude
density = pressure / (r * temperature)

# Construct and return the thermal state
state = cls(density=density, temperature=temperature, material=Air())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure where this model comes from, but I think implementation of US standard atmosphere model is more complex, here is one implementation: https://github.com/flexcompute/design360/blob/develop/design360/client/utils/atmosphere_model.py

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied your implementation

@benflexcompute benflexcompute merged commit a15be58 into develop Aug 2, 2024
12 checks passed
@benflexcompute benflexcompute deleted the UnderConstruction/SimulationInterface branch August 2, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants